namespace NavigateExample.Services.Navigation;

//导航结果实现类
public class NavigationResult : INavigationResult
{
    public bool Success { get; }
    public string? ErrorMessage { get; }
    public Exception? Exception { get; }

    private NavigationResult(bool success, string? errorMessage = null, Exception? exception = null)
    {
        Success = success;
        ErrorMessage = errorMessage;
        Exception = exception;
    }
    
    // 创建成功的导航结果
    public static NavigationResult CreateSuccess()
    {
        return new NavigationResult(true);
    }
    // 创建失败的导航结果
    public static NavigationResult CreateFailure(string errorMessage, Exception? exception = null)
    {
        return new NavigationResult(false, errorMessage, exception);
    }
}